'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	try {
		const collection = db.collection('banners')
		const res = await collection.where({
			status: 1 // 1表示启用状态
		}).orderBy('sort', 'asc').get()
		
		return {
			code: 0,
			msg: '获取成功',
			data: res.data
		}
	} catch (e) {
		return {
			code: -1,
			msg: '获取失败',
			data: []
		}
	}
}; 